import {
    Button,
    Cascader,
    Form,
    Input,
    Radio,
    Select,
} from 'antd';
import {addFloor} from '../../../../../../utils/hsyHttp/hsyhttp.jsx'
import PageName from "../../../../../../../src/components/PageName/index.jsx";
import React from 'react';
import ReactDOM from 'react-dom';
import { useNavigate} from "react-router-dom"

// import { Map, MapApiLoaderHOC } from 'react-bmapgl'
// import BMapGL from 'react-bmapgl'


// MapApiLoaderHOC({ak: '6paLeTnFgfeAAlz7l3xDq2r4NCcla49z'})
const PropertyInformation = () => {
    const navigate = useNavigate()
    const { TextArea } = Input;
    const Add = (values) => {
        console.log('提交内容', values);
        //第一步，得到一个formData盒子
        let myFormData = new FormData()
        //第二步，讲文件装到这个盒子里面去  组装数据
        // myFormData.append(内容的名字，内容)  如果这个内容是一个文件，放的就是文件对象
        // myFormData.append('myfile1',values.consult_img.file.originFileObj)
        // myFormData.append('s_name',values.consult_title)
        myFormData.append('c_name', values.c_name)
        myFormData.append('c_othername', values.c_othername)
        myFormData.append('c_referenceallprice', values.c_referenceallprice)
        myFormData.append('c_price', values.c_price)
        myFormData.append('c_characteristic', values.c_characteristic)
        myFormData.append('c_wuye', values.c_wuye)
        myFormData.append('c_address', values.c_address)
        myFormData.append('c_area', values.c_area)
        myFormData.append('c_railtransit', values.c_railtransit)
        myFormData.append('c_admin', values.c_admin)
        myFormData.append('s_state',values.s_state)
        myFormData.append('s_begintime',values.s_begintime)
        myFormData.append('s_endtime',values.s_endtime)
        myFormData.append('s_certificate',values.s_certificate)
        myFormData.append('s_certificatenum',values.s_certificatenum)
        myFormData.append('s_binding',values.s_binding)
        myFormData.append('s_preferential',values.s_preferential)
        myFormData.append('p_developers',values.p_developers)
        myFormData.append('p_ownershipperiod',values.p_ownershipperiod)
        myFormData.append('p_buildingtype',values.p_buildingtype)
        myFormData.append('p_decorationstatus',values.p_decorationstatus)
        myFormData.append('p_rongji',values.p_rongji)
        myFormData.append('p_luhua',values.p_luhua)
        myFormData.append('p_allnum',values.p_allnum)
        myFormData.append('p_car',values.p_car)
        myFormData.append('p_property',values.p_property)
        myFormData.append('p_propertynum',values.p_propertynum)
        myFormData.append('p_type',values.p_type)



    
        addFloor(myFormData).then(res => {
            navigate('/home/NewFloor')
          message.success('添加成功')
        })
      }
    

    return (
        <>
            <PageName name="基本信息" />
            <Form
             onFinish={Add}
                labelCol={{
                    span: 4,
                }}
                wrapperCol={{
                    span: 14,
                }}
                layout="horizontal"
                style={{
                    maxWidth: 600,
                }}
            >
                <Form.Item label="楼盘名称" name="c_name">
                    <Input />
                </Form.Item>
                <Form.Item label="楼盘别名" name="c_othername">
                    <Input />
                </Form.Item>
                <Form.Item label="参考均价" name="c_price">
                    <Input />
                </Form.Item>
                <Form.Item label="参考总价" name="c_referenceallprice">
                    <Input />
                </Form.Item>
                <Form.Item label="项目特色" name="c_characteristic">
                    <Radio.Group>
                        <Radio value="普通住宅"> 普通住宅 </Radio>
                        <Radio value="花园洋房"> 花园洋房 </Radio>
                        <Radio value="品牌地产"> 品牌地产 </Radio>
                        <Radio value="不限购"> 不限购 </Radio>
                        <Radio value="豪华居住区"> 豪华居住区 </Radio>
                        <Radio value="低密居所"> 低密居所 </Radio>
                        <Radio value="经济住宅"> 经济住宅 </Radio>
                        <Radio value="学区房"> 学区房 </Radio>
                    </Radio.Group>
                </Form.Item>
                <Form.Item label="所在区域" name="c_area">
                    <Select>
                        <Select.Option value="朝阳">朝阳</Select.Option>
                        <Select.Option value="海淀">海淀</Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item label="物业类型" name="c_wuye">
                    <Select>
                        <Select.Option value="住宅">住宅</Select.Option>
                        <Select.Option value="别墅">别墅</Select.Option>
                        <Select.Option value="公寓">公寓</Select.Option>
                        <Select.Option value="商住">商住</Select.Option>
                        <Select.Option value="商铺">商铺</Select.Option>
                        <Select.Option value="写字楼">写字楼</Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item label="楼盘地址" name="c_address">
                    <Input />
                </Form.Item>
                <Form.Item label="选择轨道交通" name="c_railtransit">
                    <Cascader
                        options={[
                            {
                                value: '一号线',
                                label: '一号线',
                                children: [
                                    {
                                        value: '苹果园站',
                                        label: '苹果园站',
                                    },
                                    {
                                        value: '古城站',
                                        label: '古城站',
                                    },
                                    {
                                        value: '八角游乐园站',
                                        label: '八角游乐园站',
                                    },
                                    {
                                        value: '八宝山站',
                                        label: '八宝山站',
                                    },
                                ],
                            },
                            {
                                value: '二号线',
                                label: '二号线',
                                children: [
                                    {
                                        value: '苹果园站',
                                        label: '苹果园站',
                                    },
                                    {
                                        value: '古城站',
                                        label: '古城站',
                                    },
                                    {
                                        value: '八角游乐园站',
                                        label: '八角游乐园站',
                                    },
                                    {
                                        value: '八宝山站',
                                        label: '八宝山站',
                                    },
                                ],
                            },
                            {
                                value: '三号线',
                                label: '三号线',
                                children: [
                                    {
                                        value: '苹果园站',
                                        label: '苹果园站',
                                    },
                                    {
                                        value: '古城站',
                                        label: '古城站',
                                    },
                                    {
                                        value: '八角游乐园站',
                                        label: '八角游乐园站',
                                    },
                                    {
                                        value: '八宝山站',
                                        label: '八宝山站',
                                    },
                                ],
                            },
                        ]}
                    />
                    {/* <Map
        style={{ height: 450 }}
        center={new BMapGL.Point(116.404449, 39.914889)}
        zoom={12}
      /> */}
                </Form.Item>
                <PageName name="销售信息" />

                <Form.Item label="销售状态" name="s_state">
                    <Select>
                        <Select.Option value="待售">待售</Select.Option>
                        <Select.Option value="在售">在售</Select.Option>
                        <Select.Option value="售完">售完</Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item label="开盘时间" name="s_begintime">
                    <Input />
                </Form.Item>
                <Form.Item label="交房时间" name="s_endtime">
                    <Input />
                </Form.Item>
                <Form.Item label="发证日期" name="s_certificate">
                    <Input />
                </Form.Item>
                <Form.Item label="销售证号" name="s_certificatenum">
                    <Input />
                </Form.Item>
                <Form.Item label="绑定楼栋" name="s_binding">
                    <Input />
                </Form.Item>
                <Form.Item label="优惠信息" name="s_preferential">
                    <Input />
                </Form.Item>
                <PageName name="规划信息" />

                <Form.Item label="开发商" name="p_developers">
                    <Input />
                </Form.Item>
                <Form.Item label="产权年限" name="p_ownershipperiod">
                    <Input />
                </Form.Item>
                <Form.Item label="建筑类型" name="p_buildingtype">
                    <Input />
                </Form.Item>
                <Form.Item label="装修状况" name=" p_decorationstatus">
                    <Input />
                </Form.Item>
                <Form.Item label="容积率" name="p_rongji">
                    <Input />
                </Form.Item>
                <Form.Item label="绿化率" name=" p_luhua">
                    <Input />
                </Form.Item>
                <Form.Item label="楼栋总数" name="p_allnum">
                    <Input />
                </Form.Item>
                <Form.Item label="车位情况" name="p_car">
                    <Input />
                </Form.Item>
                <Form.Item label="物业公司" name="p_property">
                    <Input />
                </Form.Item>
                <Form.Item label="物业费" name=" p_propertynum">
                    <Input />
                </Form.Item>
                <PageName name="楼盘简介" />

                <Form.Item>
                    <TextArea rows={4} />
                </Form.Item>
                <Form.Item>
                    <Button type="primary" htmlType="submit">
                        保存
                    </Button>
                </Form.Item>
            </Form>
        </>
    );


}
export default PropertyInformation;